<?php 
Import::appLibs("Configuration");
class JobController extends Controller {
	private $can_session;
	private $emp_session;
	public function job(){
		$job= $this->loadModel("Job");
		//$records = $employer->getList($page=1,$perpage=20,$search="",$searchFields=array(),$sortFields=array(),$sortCriteria="");
		$category = $this->loadModel("Categorie");
		$categories = $category->getCategoriesAsArray();
		$this->set(array("categories"=>$categories));
		$page = $this->get("page")!=NULL?$this->get("page"):1;
		$perpage = $this->get("perpage")!=NULL?$this->get("perpage"):20;
		$search = $this->get("search")!=NULL?$this->get("search"):"";
		$records = $job->getList($page,$perpage,$search,array("title","industry"),array());
		$this->set(array("records"=>$records));
		$this->render("admin_display");
	}
	public function __construct(){
		$this->calledClass(get_class($this));
		$this->can_session=Session::get("candidate");
		$this->emp_session=Session::get("employer");
	}
	public function pview(){
		if($this->get("id")!=NULL){
			$category = $this->loadModel("Categorie");
			$employer = $this->loadModel("Employer");
			$job = $this->loadModel("Job");
			$this->set(array("location"=>$category->GetJobTime(1)));
			$this->set(array("jobtype"=>$category->GetJobTime(20)));
			$this->set(array("PremiumOrStandard"=>$category->GetJobTime(222)));
			$this->set(array("jobmode"=>$category->GetJobTime(133)));
			$this->set(array("joblevel"=>$category->GetJobTime(137)));
			$this->set(array("level"=>$category->GetJobTime(151)));
			$this->set(array("language"=>$category->GetJobTime(156)));
			$this->set(array("gender"=>$category->GetJobTime(173)));
			$this->set(array("gen"=>$category->GetJobTime(219)));
			$this->set(array("industry"=>$category->GetJobTime(179)));
			$this->set(array("companytype"=>$category->GetJobTime(227)));
			$this->set(array("jobcategory"=>$category->GetJobTime(23)));
			$this->set(array("qualification"=>$category->GetJobTime(143)));
			$this->set(array("days"=>$category->GetJobTime(287)));
			$this->set(array("months"=>$category->GetJobTime(255)));
			
			$employers = $employer->getEmployersAsArray() ;
			$this->set(array("employers"=>$employers));
			
			//Update fields admin_view when super admin view the job
			$job->update(array("admin_view"=>1),array("id="=>$this->get("id")));
			$record = $job->FindAsObject(array("id = "=>$this->get("id")));
			$this->set(array("record"=>$record));
			$this->render("pview");
		}
	}
	public function index(){
		$jobs = $this->loadModel("Job");
		$this->set(array("list"=>$jobs->getList($this->get("page"),12,$this->get("search"),array("id","title","job_categories","location","expire_date"),array("created"),"DESC")));
		$this->getCatogorys();
		$this->render("ltablepost");
	}
	/* public function selectSaveJob(){
		$user = $this->loadModel("Jobseeker");
		$savejob = $this->loadModel("SaveJob");
		$this->showItemsDropdownSearch();
		$this->getAdvertisement();
		$postid=@$savejob->getCompSavePostID($this->get("idsave"));
		if($postid==$this->get("idsave")){
			$savejob->edit(array("pos_id"=>trim($this->get("idsave"))),array("pos_id"=>$this->get("idsave")));
		}else{
			$recordSaveJob=$savejob->save(array("pos_id"=>trim($this->get("idsave")),"usr_id"=>Session::get("user")->id));
		}
		$savejob->deleteJobSero();
		$this->set(array("list"=>$savejob->getSaveJobs(1,12,$recordSaveJob->usr_id)));
		$this->layout="index_admin";
		$this->set(array("layout"=>"jobsave"));
		$this->render();
	} */
	public function selectSaveJob(){
		$jobs = $this->loadModel("Job");
		$savejob = $this->loadModel("SaveJob");
		$savejob->save(array(
				"job_id"=>trim($this->get("idsave"))
		));
		$this->set(array("list"=>$savejob->getSaveJob()));
		$this->getCatogorys();
		$this->render("selectsavejob");
	}
	public function viewJob(){
		$jobs = $this->loadModel("Job");
		$job_id=$this->get("job_id");
		if($job_id){
			$jobs->findObject(array("id="=>$job_id));
			$this->set(array("objFindWhere"=>$jobs->findObject(array("id="=>$job_id))));
		}
		$this->getCatogorys();
		$this->render("viewjob");
	}
	public function overviewApplyJob(){
		$applyjob = $this->loadModel("NotiApplie");
		$ads = $this->loadModel("Advert");
		$resume = $this->loadModel("Resume");
		//$adverts = $ads->getAdvertsAndCategorize();
		$this->set(array("adstopleft"=>isset($adverts[1])?$adverts[1]:array()));
		$this->set(array("adstopcenter"=>isset($adverts[2])?$adverts[2]:array()));
		$this->set(array("adstopright"=>isset($adverts[3])?$adverts[3]:array()));
		$this->set(array("adsmiddleleft"=>isset($adverts[4])?$adverts[4]:array()));
		$this->set(array("adsmiddlecenter"=>isset($adverts[5])?$adverts[5]:array()));
		$this->set(array("adsmiddleright"=>isset($adverts[6])?$adverts[6]:array()));
		$this->set(array("adsbottom"=>isset($adverts[7])?$adverts[7]:array()));
		$this->set(array("SelectY"=>$resume->SelectQu(333)));
		$this->set(array("Select"=>$resume->SelectQu(143)));
		$this->set(array("Location"=>$resume->SelectQu(1)));
		$this->set(array("Position"=>$resume->SelectQu(137)));
		$this->set(array("category"=>$resume->SelectQu(23)));
			$applyjob->edit(array(
					"status"=>1,
			),array("id="=>$this->get("appid")));
		$this->set(array("row"=>$resume->getOverviewResume(array("Resumes.id="=>$this->get("overview")))));
		$this->set(array("main_body"=>"appjobdetail"));
		$this->layout="home2";
		$this->render();
	}
	/*  
	 * @Developer: Mr.Dim sidet
	 * @Create Date: 4-April-2014
	 * @Return overview job
	 * */
	public function showJob(){
		$this->set(array("mnu"=>"home"));
		$jobs = $this->loadModel("Job");
		$ads = $this->loadModel("Advert");
		$overview=($this->get("id")=="id")?$this->get("id"):$this->get("id");
		if($overview){
			$adverts = $ads->getAdvertsAndCategorize();
			$this->set(array("adstopleft"=>isset($adverts[1])?$adverts[1]:array()));
			$this->set(array("adstopcenter"=>isset($adverts[2])?$adverts[2]:array()));
			$this->set(array("adstopright"=>isset($adverts[3])?$adverts[3]:array()));
			$this->set(array("adsmiddleleft"=>isset($adverts[4])?$adverts[4]:array()));
			$this->set(array("adsmiddlecenter"=>isset($adverts[5])?$adverts[5]:array()));
			$this->set(array("adsmiddleright"=>isset($adverts[6])?$adverts[6]:array()));
			$this->set(array("adsbottom"=>isset($adverts[7])?$adverts[7]:array()));
			
			$jobs->getImageIDofEmployer($this->get("id"));
			$job_info = $jobs->findObject(array("Jobs.id="=>$this->get("id")));
			$jobs->edit(array("hits"=>$job_info->hits+9),array("Jobs.id="=>$this->get("id")));
			$this->set(array("objFindWhere"=>$jobs->getOverviewJobs(array("Jobs.id="=>$this->get("id")),$this->get("id"))));
		}
		$this->getCatogorys();
		$this->set(array("main_body"=>"jobdetail"));
		$visitor = $this->loadModel("Visitor");
		$this->set(array("visitor"=>$visitor->getCounter()));
		$this->layout="lightblue";
		$this->render();
	}
	public function searchJob(){
		$jobs = $this->loadModel("Job");
		$category=$this->get("category");
		$location=$this->get("location");
		$jobtime=$this->get("jobtime");
		$description=$this->get("description");
		if($category || $location || $jobtime || $description ){
			$this->set(array("list"=>$jobs->getAdvanceSearchJob($this->get("page"),12,array("job_categories"=>$category,"location"=>$location,"description"=>$description,"job_time"=>$jobtime),array("emp_id"=>$this->emp_session["id"]),array("created"),"DESC","AND")));
		}else {
			$this->set(array("list"=>$jobs->getAdvanceSearchJob($this->get("page"),12,array("job_categories"=>$category,"location"=>$location,"description"=>$description,"job_time"=>$jobtime),array("emp_id"=>$this->emp_session["id"]),array("created"),"DESC")));
		}
		//$this->set(array("list"=>$jobs->getList($this->get("page"),12,$this->get("search"),array("id","title","by_company","job_categories","location","expire_date"),array("created"),"DESC")));
		$this->getCatogorys();
		$this->render("ltableseekersearchjob");
	}
	public function display(){
		$jobs = $this->loadModel("Job");
		$category=$this->get("category");
		$location=$this->get("location");
		$jobtime=$this->get("jobtime");
		$description=$this->get("description");
		if($category || $location || $jobtime || $description ){
			$this->set(array("list"=>$jobs->getAdvanceSearchJob($this->get("page"),12,array("job_categories"=>$category,"location"=>$location,"title"=>$description,"job_time"=>$jobtime),array("emp_id"=>$this->emp_session["id"]),array("created"),"DESC","AND")));
		}else {
			$this->set(array("list"=>$jobs->getAdvanceSearchJob($this->get("page"),12,array("job_categories"=>$category,"location"=>$location,"title"=>$description,"job_time"=>$jobtime),array("emp_id"=>$this->emp_session["id"]),array("created"),"DESC")));
		}
		$category = $this->loadModel("Categorie");
		$this->set(array("location"=>$category->getCategories(1)));
		$this->set(array("jobtype"=>$category->getCategories(20)));
		$this->set(array("jobmode"=>$category->getCategories(133)));
		$this->set(array("joblevel"=>$category->getCategories(137)));
		$this->set(array("level"=>$category->getCategories(151)));
		$this->set(array("language"=>$category->getCategories(156)));
		$this->set(array("gender"=>$category->getCategories(173)));
		$this->set(array("industry"=>$category->getCategories(179)));
		$this->set(array("companytype"=>$category->getCategories(227)));
		$this->set(array("jobcategory"=>$category->getCategories(23)));
		$this->set(array("qualification"=>$category->getCategories(143)));
		$this->set(array("days"=>$category->getCategories(287)));
		$this->set(array("months"=>$category->getCategories(255)));
		$this->getCatogorys();
		$this->set(array("layout"=>"displaypost"));
		$this->render(array("employer"=>"admin"));
	}
	/**
		this function was modified by Mr. Phireak 
	*/
	/* 
	 * Developer: Mr.Dim sidet
	 * Date Modify: 18-March-2014
	 * Return: if user  has been buy ready package and post standard and premium job is comparig righg then user can post new job. but you have to buy package. 
	 *  */	
	public function addNewOld(){
		$jobs = $this->loadModel("Job");
		$member = $this->loadModel("Membership");
		$config = $this->loadModel("Config");
		$post = $config->findAsObject(array("id="=>1));
		/* Checking number of job post type both standard and premium */
		$standard_post = $jobs->getNumberOfJobPost($this->emp_session["id"],"free");
		$premium_post = $jobs->getNumberOfJobPost($this->emp_session["id"],"premium");
		/*Checking their posting point first before they can create a new Job */
		$checkpoint = $member->findAsObject(array("user_id="=>$this->emp_session["id"],"sub_type="=>"Employer"));
		if( $standard_post <= $post->standard_post && $checkpoint->posting_point==0){
			if($premium_post > $post->premium_post && $checkpoint->posting_point==0){
				$this->set(array("premium"=>"No"));
			}
			$this->saveJob();
		}elseif( $premium_post <= $post->premium_post && $checkpoint->posting_point==0){
			if($standard_post >$post->standard_post && $checkpoint->posting_point==0){
				$this->set(array("standard"=>"No"));
			}
			$this->saveJob();
		/*}elseif( $standard_post<=$post->standard_post  && $checkpoint->posting_point!=0){
			if($premium_post > $post->premium_post && $checkpoint->posting_point!=0){
				$this->set(array("premium"=>"No"));
			}
			$this->saveJob();
		}elseif($premium_post<=$post->premium_post  &&  $checkpoint->posting_point!=0){
			if($standard_post >$post->standard_post && $checkpoint->posting_point!=0){
				$this->set(array("standard"=>"No"));
			}
			$this->saveJob();
			//$standard_post >$post->standard_post && $premium_post >$post->premium_post  &&
		*/
		}elseif($checkpoint->posting_point!=0){
			//echo $standard_post .">".$post->standard_post ."&&". $premium_post .">".$post->premium_post  ."&&". $checkpoint->posting_point."!=0";
			$this->saveJob();
		}else{
			if($checkpoint->posting_point){
				$this->set(array("mnu"=>"job"));
				$this->getCatogorys();
				$this->set(array("posting_point"=>$checkpoint->posting_point));
				$this->set(array("standard_post"=>$standard_post,"standard_total"=>$post->standard_post));
				//$this->set(array("premium_post"=>$premium_post,"premium_total"=>$post->premium_post));
				$this->set(array("premium_post"=>$post->per_premium_post));
				$this->set(array("layout"=>"newpost"));
				$this->render(array("employer"=>"admin"));
			}else{
				/*
				 * If their stardard post equal to limitation of stadard post and posting point equal 0
			 * so , they need to upgrade their account type to premium to create new job and post more...(by order more package)
				*/
				echo 0;
				//$this->redirect(array("package"=>"displayfront"));
			}
		}
	}
	/**
	 * Author By Pisey
	 * function when employer click add new job with show the credit that employers left
	 */
	public function addNew(){
		$jobs = $this->loadModel("Job");
		$member = $this->loadModel("Membership");
		$employer = $this->loadModel("Employer");
		$gallery = $this->loadModel("Gallery");
		$config = $this->loadModel("Config");
		$post = $config->findAsObject(array("id="=>1));
		/* Profile photo */
		$emp_info = $employer->findObject(array("id="=>$this->emp_session["id"]));
		$this->set(array("employer"=>$emp_info));
		$this->set(array("emp_imgs"=>$gallery->findObject(array("id="=>$emp_info->img_id))));
		/* Checking number of job post type both standard and premium */
		$standard_post = $jobs->getNumberOfJobPost($this->emp_session["id"],"free");
		$premium_post = $jobs->getNumberOfJobPost($this->emp_session["id"],"premium");
		/*Checking their posting point first before they can create a new Job */
		$checkpoint = $member->findAsObject(array("user_id="=>$this->emp_session["id"],"sub_type="=>"Employer"));
		
		if($checkpoint){
			$this->set("posting_point",$checkpoint->posting_point);
		}else{
			$this->set(array("posting_point"=>0));
		}
		$this->set(array("mnu"=>"job"));
		$this->getCatogorys();
		$this->set(array("standard_post"=>$standard_post,"standard_total"=>$post->standard_post));
		//$this->set(array("premium_post"=>$premium_post,"premium_total"=>$post->premium_post));
		$this->set(array("premium_post"=>$post->per_premium_post));
		$this->set(array("layout"=>"newpost"));
		$this->render(array("employer"=>"admin"));
	}
	/**
	 * Author By Pisey
	 * function save job with cutting point
	 */
	
	public function addNewCategory(){
		$resumes = $this->loadModel("Job");
		$category = $this->loadModel("Category");
		/* starting of catch value from resume form  */
		$jobcategories=trim($this->get("cboJobCategory"));
		$locationRecord=trim($this->get("cboLocation"));
		$zipcodeRecord=trim($this->get("txtzip"));
		/* ending of catch value from resume form  */
		/* staring of compare input select where name store id in function,education,experience,and location */
		$job_clasification = $resumes->getCategoryId($catefuncRecord);
		$cbEdu = $resumes->getCategoryId($educationRecord);
		$cbYwork = $resumes->getCategoryId($jobcategories);
		$location = $resumes->getCategoryId($locationRecord);
		$country = $resumes->getCategoryId($countryRecord);
		$zipcode = $resumes->getCategoryID($zipcodeRecord);
		/* ending of compare input select where name store id in in function,education,experience,and location */
		/* staring of select category in function,education,experience,and location with searchset field */
		$searchSet_job_classify = $resumes->getSearchSet(23);
		$searchSet_education = $resumes->getSearchSet(138);
		$searchSet_jobcategories = $resumes->getSearchSet(23);
		$searchSet_location = $resumes->getSearchSet(1);
		$searchSet_country = $resumes->getSearchSet(34);
		$searchSet_zipcode = $resumes->getSearchSet(180);
	
		
		/*ending of add new category if it is not in job clasification category*/
		/*starting of add new category if it is not in location category*/
		if(!$resumes->checkCategory($locationRecord)){
			$locat = $category->save(array("name"=>$locationRecord,"parent_id"=>"1"));
			$category->update(array("search_set"=>$searchSet_location->search_set.",".$locat->id),array("id="=>"1"));
			$resumes->update(array("location_category"=>$locationRecord),array("user_id = "=>$this->get("id")));
		}else{
			$resumes->update(array("location_category"=>$locationRecord),array("user_id = "=>$this->get("id")));
		}
		/*ending of add new category if it is not in education category*/
		/*starting of add new category if it is not in  work experience category*/
		if(!$resumes->checkCategory($jobcategories)){
			$jobcategory = $category->save(array("name"=>$jobcategories,"parent_id"=>"23"));
			$category->update(array("search_set"=>$searchSet_jobcategories->search_set.",".$jobcategory->id),array("id="=>"23"));
			$resumes->update(array("job_category"=>$jobcategories),array("user_id = "=>$this->get("id")));
		}else{
			$resumes->update(array("job_category"=>$jobcategories),array("user_id = "=>$this->get("id")));
		}
		
		/*ending of add new category if it is not in location category*/
	}
	
	public function saveJob(){
		$jobs = $this->loadModel("Job");
		$member = $this->loadModel("Membership");
		$config = $this->loadModel("Config");
		$employer = $this->loadModel("Employer");
		$post = $config->findAsObject(array("id="=>1));
		/* Checking number of job post type both standard and premium */
		$standard_post = $jobs->getNumberOfJobPost($this->emp_session["id"],"free");
		$premium_post = $jobs->getNumberOfJobPost($this->emp_session["id"],"premium");
		/*Checking their posting point first before they can create a new Job */
		$checkpoint = $member->findAsObject(array("user_id="=>$this->emp_session["id"],"sub_type="=>"Employer"));
		/* Start file Upload */
		//$ids=$this->upload($this->emp_session["id"],"data/galleries/employer/".Session::get("employer_name"),5);
		$timestampPost = strtotime($this->get("dtpPostDate"));
		$datePost=date(' Y-m-d', $timestampPost);
		$timestampLine = strtotime($this->get("dtpDeadLine"));
		$deadline=date(' Y-m-d', $timestampLine);
		if($this->get("cboJobType") == "premium"){
			$this->cutPoint();
		}
		$recordJob=$jobs->save(array(
			"title"=>trim($this->get("txtTitle")),
			"number_of_hire"=>trim($this->get("txtHire")),
			"post_mode"=>trim($this->get("cboJobType")),
			"job_type"=>trim($this->get("cboJobTime")),
			"posted_by"=>trim($this->get("txtPostBy")),
			"location_category"=>trim($this->get("cboLocation")),
			"qualification"=>trim($this->get("cboQualification")),
			"job_category"=>trim($this->get("cboJobCategory")),
			"gender"=>trim($this->get("cboGender")),
			"age"=>trim($this->get("txtAge")),
			"posting_date"=>trim($datePost),
			"deadline"=>trim($deadline),
			"introduction"=>get_magic_quotes_gpc() ? stripslashes($this->get("txtaProfile")) : $this->get("txtaProfile"),
			"description"=>get_magic_quotes_gpc() ? stripslashes($this->get("txtaDescription")) : $this->get("txtaDescription"),
			"education"=>get_magic_quotes_gpc() ? stripslashes($this->get("txtaEducation")) : $this->get("txtaEducation"),
			"about_company"=>get_magic_quotes_gpc() ? stripslashes($this->get("txtaProfile")) : $this->get("txtaProfile"),
			"key_competencies"=>get_magic_quotes_gpc() ? stripslashes($this->get("txtKeyCompetencies")) :         $this->get("txtKeyCompetencies"),
			"how_to_apply"=>get_magic_quotes_gpc() ? stripslashes($this->get("txtaApply")) : $this->get("txtaApply"),
			"contact_person"=>trim($this->get("txtContact")),
			"telephone"=>trim($this->get("txtTelephone")),
			"email"=>trim($this->get("txtEmail")),
			"website"=>trim($this->get("txtWebsite")),
			"address"=>trim($this->get("txtAddress")),
			"version"=>1 ,
			"hits"=>$this->get("cboJobType")=="premium"?6:10, //update hits if post as premium 6 and standard 10
			"approved"=>"Y",
			"post_date"=>date("Y-m-d H:i:s"),
			"user_id"=>$this->emp_session["id"],
			"publish"=>"Y",
			"publish_date"=>date("Y-m-d"),
			"modified"=>date("Y-m-d H:i:s")
		));
		$this->addNewCategory();
		//$employer->update(array("company_name"=>trim($this->get("txtPostBy"))),array("id="=>$this->emp_session["id"]));
		//show that save successfully
		$this->redirect(array("employer"=>"jobview"));
	}
		/**
	 * Author by chamnan
	 * function for save job without publish
	 */
	public function saveWithoutPublish(){
		$jobs = $this->loadModel("Job");
		$member = $this->loadModel("Membership");
		$config = $this->loadModel("Config");
		$employer = $this->loadModel("Employer");
		$post = $config->findAsObject(array("id="=>1));
		/* Checking number of job post type both standard and premium */
		$standard_post = $jobs->getNumberOfJobPost($this->emp_session["id"],"free");
		$premium_post = $jobs->getNumberOfJobPost($this->emp_session["id"],"premium");
		/*Checking their posting point first before they can create a new Job */
		$checkpoint = $member->findAsObject(array("user_id="=>$this->emp_session["id"],"sub_type="=>"Employer"));
		/* Start file Upload */
		//$ids=$this->upload($this->emp_session["id"],"data/galleries/employer/".Session::get("employer_name"),5);
		$timestampPost = strtotime($this->get("dtpPostDate"));
		$datePost=date(' Y-m-d', $timestampPost);
		$timestampLine = strtotime($this->get("dtpDeadLine"));
		$deadline=date(' Y-m-d', $timestampLine);		
		$recordJob=$jobs->save(array(
				"title"=>trim($this->get("txtTitle")),
				"number_of_hire"=>trim($this->get("txtHire")),
				"post_mode"=>trim($this->get("cboJobType")),
				"job_type"=>trim($this->get("cboJobTime")),
				"posted_by"=>trim($this->get("txtPostBy")),
				"location_category"=>trim($this->get("cboLocation")),
				"qualification"=>trim($this->get("cboQualification")),
				"job_category"=>trim($this->get("cboJobCategory")),
				"gender"=>trim($this->get("cboGender")),
				"age"=>trim($this->get("txtAge")),
				"posting_date"=>trim($datePost),
				"deadline"=>trim($deadline),
				"introduction"=>get_magic_quotes_gpc() ? stripslashes($this->get("txtaProfile")) : $this->get("txtaProfile"),
				"description"=>get_magic_quotes_gpc() ? stripslashes($this->get("txtaDescription")) : $this->get("txtaDescription"),
				"education"=>get_magic_quotes_gpc() ? stripslashes($this->get("txtaEducation")) : $this->get("txtaEducation"),
				"about_company"=>get_magic_quotes_gpc() ? stripslashes($this->get("txtaProfile")) : $this->get("txtaProfile"),
				"key_competencies"=>get_magic_quotes_gpc() ? stripslashes($this->get("txtKeyCompetencies")) :         $this->get("txtKeyCompetencies"),
				"how_to_apply"=>get_magic_quotes_gpc() ? stripslashes($this->get("txtaApply")) : $this->get("txtaApply"),
				"contact_person"=>trim($this->get("txtContact")),
				"telephone"=>trim($this->get("txtTelephone")),
				"email"=>trim($this->get("txtEmail")),
				"website"=>trim($this->get("txtWebsite")),
				"address"=>trim($this->get("txtAddress")),
				"approved"=>"N",
				"post_date"=>date("Y-m-d H:i:s"),
				"user_id"=>$this->emp_session["id"],
				"publish_date"=>date("Y-m-d"),
				"publish"=>"Y"
		));
		//$employer->update(array("company_name"=>trim($this->get("txtPostBy"))),array("id="=>$this->emp_session["id"]));
		//show that save successfully
		$this->addNewCategory();
		
	}
	
	public function RefreshJob(){
		$job = $this->loadModel("Job");
		$result = $job->findObject(array("id="=>$this->get("pid")));
		$deadline = date("Y-m-d",strtotime("now") + (86400 *30));
		$recordJob=$job->save(array(
				"title"=>$result->title,
				"number_of_hire"=>$result->number_of_hire,
				"post_mode"=>$result->post_mode,
				"job_type"=>trim($this->get("Jobtype")),
				"posted_by"=>$result->posted_by,
				"location_category"=>$result->location_category,
				"qualification"=>$result->qualification,
				"job_category"=>$result->job_category,
				"gender"=>$result->gender,
				"age"=>$result->age,
				"posting_date"=>date("Y-m-d H:i:s"),
				"deadline"=>$deadline,
				"introduction"=>get_magic_quotes_gpc() ? stripslashes($result->introduction) : $result->introduction,
				"description"=>get_magic_quotes_gpc() ? stripslashes($result->description) : $result->description,
				"education"=>get_magic_quotes_gpc() ? stripslashes($result->education) : $result->education,
				"about_company"=>get_magic_quotes_gpc() ? stripslashes($result->about_company) : $result->about_company,
				"key_competencies"=>get_magic_quotes_gpc() ? stripslashes($result->key_competencies) : $result->key_competencies,
				"how_to_apply"=>get_magic_quotes_gpc() ? stripslashes($result->how_to_apply) : $result->how_to_apply,
				"contact_person"=>$result->contact_person,
				"telephone"=>$result->telephone,
				"email"=>$result->email,
				"website"=>$result->website,
				"address"=>$result->address,
				"version"=>1 ,
				"hits"=>$this->get("cboJobType")=="premium"?6:10 , //update hits if post as premium 3 and standard 10
				"approved"=>"Y",
				"post_date"=>date("Y-m-d H:i:s"),
				"user_id"=>$result->user_id,
				"publish"=>"Y",
				"publish_date"=>date("Y-m-d"),
				"modified"=>date("Y-m-d")
		));
		$this->cutPoint();
		$this->addNewCategory();
		$this->redirect(array("employer"=>"jobview"));
	}
	
	public function updateAndPublish(){
		$jobs = $this->loadModel("Job");
		$member = $this->loadModel("Membership");
		$config = $this->loadModel("Config");
		$employer = $this->loadModel("Employer");
		$post = $config->findAsObject(array("id="=>1));
		/* Checking number of job post type both standard and premium */
		$standard_post = $jobs->getNumberOfJobPost($this->emp_session["id"],"free");
		$premium_post = $jobs->getNumberOfJobPost($this->emp_session["id"],"premium");
		/*Checking their posting point first before they can create a new Job */
		$checkpoint = $member->findAsObject(array("user_id="=>$this->emp_session["id"],"sub_type="=>"Employer"));
		/* Start file Upload */
		//$ids=$this->upload($this->emp_session["id"],"data/galleries/employer/".Session::get("employer_name"),5);
		$timestampPost = strtotime($this->get("dtpPostDate"));
		$datePost=date(' Y-m-d', $timestampPost);
		$timestampLine = strtotime($this->get("dtpDeadLine"));
		$deadline=date(' Y-m-d', $timestampLine);
		if($this->get("cboJobType") == "premium"){
			$this->cutPoint();
		}
		$recordJob=$jobs->edit(array(
				"title"=>trim($this->get("txtTitle")),
				"number_of_hire"=>trim($this->get("txtHire")),
				"job_type"=>trim($this->get("cboJobTime")),
				"posted_by"=>trim($this->get("txtPostBy")),
				"location_category"=>trim($this->get("cboLocation")),
				"qualification"=>trim($this->get("cboQualification")),
				"job_category"=>trim($this->get("cboJobCategory")),
				"gender"=>trim($this->get("cboGender")),
				"age"=>trim($this->get("txtAge")),
				"posting_date"=>trim($datePost),
				"deadline"=>trim($deadline),
				"introduction"=>get_magic_quotes_gpc() ? stripslashes($this->get("txtaProfile")) : $this->get("txtaProfile"),
				"description"=>get_magic_quotes_gpc() ? stripslashes($this->get("txtaDescription")) : $this->get("txtaDescription"),
				"education"=>get_magic_quotes_gpc() ? stripslashes($this->get("txtaEducation")) : $this->get("txtaEducation"),
				"about_company"=>get_magic_quotes_gpc() ? stripslashes($this->get("txtaProfile")) : $this->get("txtaProfile"),
				"key_competencies"=>get_magic_quotes_gpc() ? stripslashes($this->get("txtKeyCompetencies")) :         $this->get("txtKeyCompetencies"),
				"how_to_apply"=>get_magic_quotes_gpc() ? stripslashes($this->get("txtaApply")) : $this->get("txtaApply"),
				"contact_person"=>trim($this->get("txtContact")),
				"telephone"=>trim($this->get("txtTelephone")),
				"email"=>trim($this->get("txtEmail")),
				"website"=>trim($this->get("txtWebsite")),
				"address"=>trim($this->get("txtAddress")),
				"version"=>1 ,
				"approved"=>"Y",
				"post_date"=>date("Y-m-d H:i:s"),
				"user_id"=>$this->emp_session["id"],
				"publish"=>"Y",
				"hits"=>9 ,
				"publish_date"=>date("Y-m-d"),
				"modified"=>date("Y-m-d H:i:s")
		),array("id="=>$this->get("pid")));
		$this->addNewCategory();
		//$employer->update(array("company_name"=>trim($this->get("txtPostBy"))),array("id="=>$this->emp_session["id"]));
		//show that save successfully
		$this->redirect(array("employer"=>"jobview"));
	}
	/**
	 * Author by Pisey : Modified Mr. Phireak
	 * function for cutting point
	 */
	public function cutPoint(){
		$membership= $this->loadModel("Membership");
		$config= $this->loadModel("Config");
		$totalpoint=$membership->getMemberShipPoint($this->emp_session["id"]);
		//$pointcut=$config->getAdminCutPoint();
		$config_record = $config->findAsObject(array("id="=>1));
		if($totalpoint >= $config_record->per_premium_post){
			$totolpointcut=intval($totalpoint)-intval($config_record->per_premium_post);
			$membership->update(array("posting_point"=>$totolpointcut ),array("user_id="=>$this->emp_session["id"],"sub_type="=>"Employer") );
		}
	}
	public function edit(){
		$jobs = $this->loadModel("Job");
		/* $member = $this->loadModel("Membership");
		$config = $this->loadModel("Config");
		$employer = $this->loadModel("Employer");
		$gallery = $this ->loadModel("Gallery");
		$emp_info = $employer->findObject(array("id="=>$this->emp_session["id"]));
		$this->set(array("employer"=>$emp_info));
		$this->set(array("emp_imgs"=>$gallery->findObject(array("id="=>$emp_info->img_id))));
		$post = $config->findAsObject(array("id="=>1));
		$standard_post = $jobs->getNumberOfJobPost($this->emp_session["id"],"free");
		$premium_post = $jobs->getNumberOfJobPost($this->emp_session["id"],"premium");
		$this->set(array("mnu"=>"job")); */
		$employer = $this->loadModel("Employer");
		$gallery = $this ->loadModel("Gallery");
		$config = $this->loadModel("Config");
		$emp_info = $employer->findObject(array("id="=>$this->emp_session["id"]));
		$this->set(array("employer"=>$emp_info));
		$this->set(array("emp_imgs"=>$gallery->findObject(array("id="=>$emp_info->img_id))));
		$this->getCatogorys();
		$this->set(array("record"=>$jobs->getJobToEdit($this->get("pid"))));
		/*
		* @Developer by : Mr.Dim sidet,Web Developer
		* @Create date : 7-April-2014
		* @Return : day can edit and not edit job for employer
		* */
		/* get day publish job  */
		$datejobpublic=$jobs->getPublisJob($this->get("pid"));
		/* get day limit expire job */
		$expireDateEdit=$config->getExpireDateEditJob();
		$date = strtotime($datejobpublic);
		$dateExpireJob = strtotime("+$expireDateEdit day", $date);
		$curdate=strtotime(date('Y-m-d'));
		$this->set(array("numberExpireDate"=>$expireDateEdit));
		$dayLeftExpire =($dateExpireJob - $curdate)  / (60 * 60 * 24);
		$this->set(array("dayLeftExpire"=>$dayLeftExpire));
		/* get approve job  */
		$approve=$jobs->getApproveJob($this->get("pid"));
		if( $curdate > $dateExpireJob && $approve=="Y"){
			$this->set(array("expireDate"=>1));
		}
		/* $checkpoint = $member->findAsObject(array("user_id="=>$this->emp_session["id"],"sub_type="=>"Employer"));
			if(($premium_post > $post->premium_post) && ($checkpoint->posting_point==0 || $checkpoint->posting_point!=0)){
				$this->set(array("premium"=>"No"));
			}
			if(($standard_post >$post->standard_post) && ($checkpoint->posting_point==0 || $checkpoint->posting_point!=0 )){
				$this->set(array("standard"=>"No"));
			}
			if($premium_post > $post->premium_post && $standard_post >$post->standard_post && $checkpoint->posting_point==0){
				$this->set(array("Noboth"=>"Noboth"));
			} */

		/*
		 * Modify by Pisey phon
		 */
		$recordJob = $jobs->findAsObject(array("id="=>$this->get("pid")));
		$expireDateEdit=$config->findAsObject(array("id="=>1));
		if($recordJob->publish_date){
			$date = strtotime("+" . $expireDateEdit->expiredate_editjob . " day" , strtotime($recordJob->publish_date));
			$totalLeftExpire = date('Y-m-d H:i:s', $date);
			$now_date = date ("Y-m-d");
			$leftExpireEdit = (strtotime($totalLeftExpire) - strtotime($now_date)) / (60 * 60 * 24);
			$this->set(array("expireDate"=>$leftExpireEdit));
		}else if($recordJob->publish == 'N'){
			//Won't any message to employer if they d't pusblish their job
			$this->set(array("expireDate"=>"No"));
		}else{
			$this->set(array("expireDate"=>0));
		}
		$this->set(array("numberExpireDate"=>$expireDateEdit->expiredate_editjob));
		$this->set(array("layout"=>"updatepost"));
		$this->render(array("employer"=>"admin"));
	}
	public function updateJobInadmin(){ 
		$jobs = $this->loadModel("Job");
		$employer = $this->loadModel("Employer");
		$version=$jobs->version($this->get("pid"));
		$timestampPost = strtotime($this->get("dtpPostDate"));
		$datePost=date(' Y-m-d', $timestampPost);
		$timestampLine = strtotime($this->get("dtpDeadLine"));
		$deadline=date(' Y-m-d', $timestampLine);
		$jobs->edit(array(
			"title"=>trim($this->get("txtTitle")),
				//"experience"=>trim($this->get("txtExperience")),
					"number_of_hire"=>trim($this->get("txtHire")),
					"post_mode"=>trim($this->get("cboJobType")),
					"job_type"=>trim($this->get("cboJobTime")),
					"posted_by"=>trim($this->get("txtPostBy")),
					"location_category"=>trim($this->get("cboLocation")),
					"qualification"=>trim($this->get("cboQualification")),
					"job_category"=>trim($this->get("cboJobCategory")),
					//"industry"=>trim($this->get("cboIndustry")),
					//"company_type"=>trim($this->get("cboCompanyType")),
					//"language"=>trim($this->get("cboLanguage")),
					"gender"=>trim($this->get("cboGender")),
					"age"=>trim($this->get("txtAge")),
					//"marital"=>trim($this->get("cboMarital")),
					"posting_date"=>$datePost,
					"deadline"=>$deadline,
					"introduction"=>get_magic_quotes_gpc() ? stripslashes($this->get("txtaProfile")) : $this->get("txtaProfile"),
					"description"=>get_magic_quotes_gpc() ? stripslashes($this->get("txtaDescription")) : $this->get("txtaDescription"),
					"education"=>get_magic_quotes_gpc() ? stripslashes($this->get("txtaEducation")) : $this->get("txtaEducation"),
					"key_competencies"=>get_magic_quotes_gpc() ? stripslashes($this->get("txtKeyCompetencies")) : $this->get("txtKeyCompetencies"),
					"how_to_apply"=>get_magic_quotes_gpc() ? stripslashes($this->get("txtaApply")) : $this->get("txtaApply"),
					"contact_person"=>trim($this->get("txtContact")),
					"telephone"=>trim($this->get("txtTelephone")),
					"email"=>trim($this->get("txtEmail")),
					"website"=>trim($this->get("txtWebsite")),
					"address"=>trim($this->get("txtAddress")),
					"version"=>$version,
					"hits"=>9 , //update hits if 
					"publish_date"=>date("Y-m-d"),
					"modified"=>date("Y-m-d H:i:s"),
					"modify_by"=>$this->get("pid") 
			),array("id="=>$this->get("pid")));
			//$employer->update(array("company_name"=>trim($this->get("txtPostBy"))),array("id="=>$this->emp_session["id"]));
			$this->redirect(array("admin"=>"job"));
	}
	public function saveEdit(){
		$jobs = $this->loadModel("Job");
		$member = $this->loadModel("Membership");
		$config = $this->loadModel("Config");
		$post = $config->findAsObject(array("id="=>1));
		/* Checking number of job post type both standard and premium */
		$standard_post = $jobs->getNumberOfJobPost($this->emp_session["id"],"free");
		$premium_post = $jobs->getNumberOfJobPost($this->emp_session["id"],"premium");
		/*Checking their posting point first before they can create a new Job */
		$checkpoint = $member->findAsObject(array("user_id="=>$this->emp_session["id"],"sub_type="=>"Employer"));
		if(isset($_POST["btnUpdate"])){
			$this->updateJob();
		}else{
			$this->getCatogorys();
			$this->set(array("layout"=>"updatepost"));
			$this->render(array("employer"=>"admin"));
		}
	}
	public function updateJob(){
		$jobs = $this->loadModel("Job");
		$employer = $this->loadModel("Employer");
		$version=$jobs->version($this->get("pid"));
        $timestampPost = strtotime($this->get("dtpPostDate"));
		$datePost=date(' Y-m-d', $timestampPost);
		$timestampLine = strtotime($this->get("dtpDeadLine"));
		$deadline=date(' Y-m-d', $timestampLine);
			$jobs->edit(array(
					"title"=>trim($this->get("txtTitle")),
					//"experience"=>trim($this->get("txtExperience")),
					"number_of_hire"=>trim($this->get("txtHire")),
					//"post_mode"=>trim($this->get("cboJobType")),
					"job_type"=>trim($this->get("cboJobTime")),
					"posted_by"=>trim($this->get("txtPostBy")),
					"location_category"=>trim($this->get("cboLocation")),
					"qualification"=>trim($this->get("cboQualification")),
					"job_category"=>trim($this->get("cboJobCategory")),
					//"industry"=>trim($this->get("cboIndustry")),
					//"company_type"=>trim($this->get("cboCompanyType")),
					//"language"=>trim($this->get("cboLanguage")),
					"gender"=>trim($this->get("cboGender")),
					"age"=>trim($this->get("txtAge")),
					//"marital"=>trim($this->get("cboMarital")),
					"posting_date"=>trim($datePost),
					"deadline"=>trim($deadline),
					"introduction"=>get_magic_quotes_gpc() ? stripslashes($this->get("txtaProfile")) : $this->get("txtaProfile"),
					"description"=>get_magic_quotes_gpc() ? stripslashes($this->get("txtaDescription")) : $this->get("txtaDescription"),
					"education"=>get_magic_quotes_gpc() ? stripslashes($this->get("txtaEducation")) : $this->get("txtaEducation"),
					"key_competencies"=>get_magic_quotes_gpc() ? stripslashes($this->get("txtKeyCompetencies")) : $this->get("txtKeyCompetencies"),
					"how_to_apply"=>get_magic_quotes_gpc() ? stripslashes($this->get("txtaApply")) : $this->get("txtaApply"),
					"contact_person"=>trim($this->get("txtContact")),
					"telephone"=>trim($this->get("txtTelephone")),
					"email"=>trim($this->get("txtEmail")),
					"website"=>trim($this->get("txtWebsite")),
					"address"=>trim($this->get("txtAddress")),
					"version"=>$version,
					"hits"=>$this->get("cboJobType")=="free" ? 6 : 10 ,
					"modified"=>date("Y-m-d H:i:s"),
					"modify_by"=>$this->emp_session["id"]
			),array("id="=>$this->get("pid")));
			$this->addNewCategory();
			//$employer->update(array("company_name"=>trim($this->get("txtPostBy"))),array("id="=>$this->emp_session["id"]));
			$this->redirect(array("employer"=>"jobview"));
	}
	/*  
	 * @Developer by : Mr.Dim sidet,Web Developer
	 * @Modify Date: 7-April-2014
	 * @Return : email to employer,update approve,and update publish date
	 * */
	public function approve(){
		$job = $this->loadModel("Job");
		$employer = $this->loadModel("Employer");
		/*  
		 * @Developer by : Mr.Dim sidet,Web Developer
		 * @Create date : 7-April-2014
		 * @Return : update publish date limit day that job can edit 
		 * */
		$approve=$job->getApproveJob($this->get("jid"));
		if($approve=="N"){
			$job->edit(array("publish_date"=>date("Y-m-d")),array("id="=>$this->get("jid")));
		}
		/*  
		 * @Developer by : Mr.Dim sidet,Web Developer
		 * @Create date : 7-April-2014
		 * @Return : update approve to Y and N 
		 * */
		//$this->get("approve")
		echo $job->updateProve($this->get("jid"),$this->get("approve"));
		/*
		* @Developer by : Mr.Dim sidet,Web Develope
		* @Create date : 7-April-2014
		* @Return : provide informatin for employer by admin approve
		* */
		$emp_email=$job->sendEmailToEmployee($this->get("jid"));
		$emp_Email=$emp_email->eemail;
		$str = "<b>Your HRCambodia .com Daily Job Alert</b><br/>";
		$str .="<br/><span style='font-family: Trebuchet MS;padding-right:5px'>Title: " . $emp_email->jtitle ."</span>";
		$str .="<br/><span style='font-family: Trebuchet MS'>Post Date: " . $emp_email->jpost ."</span><br/>";
		if($this->get("approve")=="Y"){
			$subject="Job has been approved by supper admin of website ";
		}elseif($this->get("approve")=="N"){
			$subject="Job has been disapproved by supper admin of website ";
		}
		//send mail to employer after updated status
		ob_start();
		//include("class.smtp.php"); // optional, gets called from within class.phpmailer.php if not already loaded
		Import::util('class.phpmailer');
		//the true param means it will throw exceptions on errors, which we need to catch
		$mail = new PHPMailer(true);
		//telling the class to use SMTP
		$mail->IsSMTP();
		try {
			// SMTP server
			$mail->Host = "mail.hrcambodia.com";
			// enables SMTP debug information (for testing),  show debug : SMTPDebug  = 2,  Hide debug : SMTPDebug  = 1
			$mail->SMTPDebug = 1;
			// enable SMTP authentication
			$mail->SMTPAuth = true;
			$mail->Port = 26;
			// SMTP account username
			$mail->Username = "noreply@hrcambodia.com";
			// SMTP account password
			$mail->Password = "pwd*123456";
			$email_address = filter_input(INPUT_GET, $emp_Email, FILTER_VALIDATE_EMAIL);
			if (!$email_address) {
				$mail->SetFrom('noreply@hrcambodia.com', 'HRCambodia');
				$mail->AddAddress($emp_Email,$emp_Email);
				$mail->AddReplyTo('admin@hrcambodia.com', 'admin@hrcambodia.com');
				$mail->Subject =$subject;
				// optional - MsgHTML will create an alternate automatically
				$mail->AltBody = 'To view the message, please use an HTML compatible email viewer!';
				$mail->MsgHTML($str ."<br/>");
				$mail->Send();
			} else {
				echo 'Email is invalid...';
				break;
			}
		} catch (phpmailerException $e) {
			//Pretty error messages from PHPMailer
			echo $e->errorMessage();
		} catch (Exception $e) {
			//Boring error messages from anything else!
			echo $e->getMessage();
		}
		
		
	}
	public function delete(){
		$jobs = $this->loadModel("Job");
		$jobs->delete(array("id="=>$this->get("jid")));
		echo 1;
	}
	public function getCatogorys(){
		$category = $this->loadModel("Categorie");
		$this->set(array("location"=>$category->getCategories(1)));
		$this->set(array("jobtype"=>$category->getCategories(20)));
		$this->set(array("jobmode"=>$category->getCategories(133)));
		$this->set(array("joblevel"=>$category->getCategories(137)));
		$this->set(array("level"=>$category->getCategories(151)));
		$this->set(array("language"=>$category->getCategories(156)));
		$this->set(array("gender"=>$category->getCategories(192)));
		$this->set(array("industry"=>$category->getCategories(179)));
		$this->set(array("companytype"=>$category->getCategories(227)));
		$this->set(array("jobcategory"=>$category->getCategories(23)));
		$this->set(array("qualification"=>$category->getCategories(143)));
		$this->set(array("days"=>$category->getCategories(287)));
		$this->set(array("months"=>$category->getCategories(255)));
	}
	public function getCatogorysAssoc(){
		$category = $this->loadModel("Categorie");
		$this->set(array("locationKey"=>$category->getCategoriesAsASSOC(1)));
		$this->set(array("jobtypeKey"=>$category->getCategoriesAsASSOC(20)));
		$this->set(array("jobmodeKey"=>$category->getCategoriesAsASSOC(133)));
		$this->set(array("joblevelKey"=>$category->getCategoriesAsASSOC(137)));
		$this->set(array("levelKey"=>$category->getCategoriesAsASSOC(151)));
		$this->set(array("languageKey"=>$category->getCategoriesAsASSOC(156)));
		$this->set(array("genderKey"=>$category->getCategoriesAsASSOC(173)));
		$this->set(array("industryKey"=>$category->getCategoriesAsASSOC(179)));
		$this->set(array("companytypeKey"=>$category->getCategoriesAsASSOC(227)));
		$this->set(array("jobcategoryKey"=>$category->getCategoriesAsASSOC(23)));
		$this->set(array("qualificationKey"=>$category->getCategoriesAsASSOC(143)));
		$this->set(array("daysKey"=>$category->getCategoriesAsASSOC(287)));
		$this->set(array("monthsKey"=>$category->getCategoriesAsASSOC(255)));
	}
	// UPLOAD FUNCTION FOR ONE OR MULTIPLE PHOTO
	public function upload($user_id,$folder="data",$size=5){
		Import::util("FileUpload");
		if(!Basic::fileExist($folder))Basic::createFolder($folder);
		$gallery = $this->loadModel("Gallery");
		$infos=FileUpload::checkFileUpload($folder);
		$helper = true;
		$ids=array();
		foreach($infos as $info ){
			if($info["error"]["number"]==0){
				if(($record=$gallery->savephoto(array("uid"=>$user_id,"gname"=>Session::get("employer_name"),"name"=>$info["name"],"location"=>"","type"=>$info["type"],"size"=>$info["size"],"d_w"=>$info["dimension"]["width"],"d_h"=>$info["dimension"]["height"],"created"=>date("Y-m-d H:s:i"),"modified"=>date("Y-m-d H:s:i"))))!==false){
					$gallery->update(array("location"=>$folder."/".$record->id.".".$info["ext"]),array("id="=>$record->id));
					$ids[]=$record->id;
					FileUpload::uploadFile($info["control"],$record->id.".".$info["ext"],5,$folder);
				}else{
					Basic::eco("<br/>There is an unexpected error occured during upload file.<br/>");
					Basic::pr($info);
					$help=false;
				}
			}
			else{
				// check error
			}
		}
		return !empty($ids)?$ids:false;
	}
	/*
	 * Created by:Mr.Chamnan
	 * Date: 2014-04-04
	 * */
	
	public function adminSearchJob(){
		$job = $this->loadModel("Job");
		$employer = $this->loadModel("Employer");
		$category = $this->loadModel("Categorie");
		//$records = $condidate->getList($page=1,$perpage=20,$search="",$searchFields=array(),$sortFields=array(),$sortCriteria="");
		//$records = $job->getList(1,20,"",array("title","posted_by"),array("id"),"DESC");
		$records = $job->getList(
				$this->get("page"),
				$this->get("perpage"),
				$this->get("search"),
				array("title","qualification","deadline"),
				array("id"),
				"DESC",
				array("location_category="=>$this->get("locations"),
						"posted_by="=>$this->get("company"),
						"post_mode="=>$this->get("type")
				)
		);
		$categories = $category->getCategoriesAsArray();
		$employers = $employer->getEmployersAsArray();
		$this->set(array("records"=>$records));
		$this->set(array("categories"=>$categories));
		$this->set(array("current_menu"=>"job"));
		$this->set(array("com"=>$this->get("company"),"locat"=>$this->get("locations"),"p"=>$this->get("type")));
		$this->set(array("companies"=>$category->getCompanies()));
		$this->set(array("location"=>$category->getCategories(1)));
		$this->set(array("post"=>$category->getCategories(222)));
		$this->render("admin_display");
	}
	/**
	 * @author Mr. Noeur Phireak
	 * return get all list job posted by category 
	 * Date : 2014-June-20
	 */
	public function show_job_by_category(){
		$job = $this->loadModel("Job");
		$this->set(array("list_job_by_category"=>$job->get_list_job_by_category()));
	}
}
